package com.bestcem.xm.member.mq;//package com.bestcem.xm.member.mq;
//
//import com.bestcem.xm.config.RabbitMqConstantConfig;
//import com.bestcem.xm.member.config.SendMemberConfig;
//import org.springframework.amqp.core.*;
//import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class MemberWechatSyncRabbitConfig {
//    /**
//     * 推送联系人配置
//     */
//    @Autowired
//    private SendMemberConfig sendMemberConfig;
//
//    @Autowired
//    private RabbitMqConstantConfig rabbitMqConstantConfig;
//
//    @Bean
//    public Queue memberWechatMemberScheduleSyncQueue() {
//        return new Queue(rabbitMqConstantConfig.getAppBpMemberWechatMemberScheduleSyncQueue(), true,
//                false, false);
//    }
//
//    @Bean
//    public DirectExchange memberWechatMemberScheduleSyncExchange() {
//        return new DirectExchange(rabbitMqConstantConfig.getAppBpMemberWechatMemberScheduleSyncExchange(), true,
//                false);
//    }
//
//    @Bean
//    public Binding memberWechatMemberScheduleSyncBinding() {
//        return BindingBuilder
//                .bind(this.memberWechatMemberScheduleSyncQueue())
//                .to(this.memberWechatMemberScheduleSyncExchange())
//                .with(rabbitMqConstantConfig.getAppBpMemberWechatMemberScheduleSyncRoutingKey());
//    }
//
//    @Bean
//    public DirectExchange memberWechatMemberSyncExchange() {
//        return new DirectExchange(rabbitMqConstantConfig.getAppBpMemberMemberWechatMemberSyncExchange(), true,
//                false);
//    }
//
//    @Bean
//    public Queue memberWechatMemberSyncQueue() {
//        return new Queue(rabbitMqConstantConfig.getAppBpMemberMemberWechatMemberSyncQueue());
//    }
//
//    @Bean
//    public Binding memberWechatMemberSyncBinding() {
//        return BindingBuilder
//                .bind(memberWechatMemberSyncQueue())
//                .to(memberWechatMemberSyncExchange())
//                .with(rabbitMqConstantConfig.getAppBpMemberMemberWechatMemberSyncRoutingKey());
//    }
//
//    /**
//     * 微信公众号授权消息使用的topicExchange
//     *
//     * @return TopicExchange
//     */
//    @Bean
//    public TopicExchange appBpPushWechatOfficialAccountGrantedExchange() {
//        return new TopicExchange(rabbitMqConstantConfig.getAppBpPushWechatOfficialAccountGrantedExchange());
//    }
//
//    /**
//     * 微信公众号授权消息队列
//     *
//     * @return Queue
//     */
//    @Bean
//    public Queue appBpPushWechatOfficialAccountGrantedQueue() {
//        return new Queue(rabbitMqConstantConfig.getAppBpPushWechatOfficialAccountGrantedQueue());
//    }
//
//    /**
//     * 微信公众号授权消息队列绑定
//     *
//     * @return Binding
//     */
//    @Bean
//    public Binding appBpPushWechatOfficialAccountGrantedBinding() {
//        return BindingBuilder.bind(appBpPushWechatOfficialAccountGrantedQueue())
//                .to(appBpPushWechatOfficialAccountGrantedExchange())
//                .with(rabbitMqConstantConfig.getAppBpPushWechatOfficialAccountGrantedRoutingKey());
//    }
//
//    /**
//     * 公众号网页授权消息使用的topicExchange
//     *
//     * @return TopicExchange
//     */
//    @Bean
//    public TopicExchange appMemberSyncWechatAccountInfoExchange() {
//        return new TopicExchange(rabbitMqConstantConfig.getAppMemberSyncWechatAccountInfoExchange());
//    }
//
//    /**
//     * 公众号网页授权消息队列
//     *
//     * @return Queue
//     */
//    @Bean
//    public Queue appMemberSyncWechatAccountInfoQueue() {
//        return new Queue(rabbitMqConstantConfig.getAppMemberSyncWechatAccountInfoQueue());
//    }
//
//    /**
//     * 公众号网页授权消息队列绑定
//     *
//     * @return Binding
//     */
//    @Bean
//    public Binding appBpPushWechatAccountInfoGrantedBinding() {
//        return BindingBuilder.bind(appMemberSyncWechatAccountInfoQueue())
//                .to(appMemberSyncWechatAccountInfoExchange())
//                .with(rabbitMqConstantConfig.getAppMemberSyncWechatAccountInfoRoutingKey());
//    }
//
//
//
//
//    @Bean
//    public RabbitListenerContainerFactory<?> memberWechatMemberScheduleSyncContainerFactory(ConnectionFactory connectionFactory) {
//        //SimpleRabbitListenerContainerFactory发现消息中有content_type有text就会默认将其转换成string类型的
//        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
//        factory.setPrefetchCount(sendMemberConfig.getReceiverPrefetchCount());
//        factory.setConnectionFactory(connectionFactory);
//        return factory;
//    }
//
//    @Bean
//    public RabbitListenerContainerFactory<?> memberWechatMemberSyncContainerFactory(ConnectionFactory connectionFactory) {
//        //SimpleRabbitListenerContainerFactory发现消息中有content_type有text就会默认将其转换成string类型的
//        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
//        factory.setPrefetchCount(sendMemberConfig.getReceiverPrefetchCount());
//        factory.setConnectionFactory(connectionFactory);
//        return factory;
//    }
//
//    @Bean
//    public RabbitListenerContainerFactory<?> appMemberSyncWechatAccountInfoQueueFactory(ConnectionFactory connectionFactory) {
//        //SimpleRabbitListenerContainerFactory发现消息中有content_type有text就会默认将其转换成string类型的
//        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
//        factory.setPrefetchCount(sendMemberConfig.getReceiverPrefetchCount());
//        factory.setConnectionFactory(connectionFactory);
//        return factory;
//    }
//
//    @Bean
//    public RabbitListenerContainerFactory<?> appBpPushWechatOfficialAccountGrantedFactory(ConnectionFactory connectionFactory) {
//        //SimpleRabbitListenerContainerFactory发现消息中有content_type有text就会默认将其转换成string类型的
//        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
//        factory.setPrefetchCount(sendMemberConfig.getReceiverPrefetchCount());
//        factory.setConnectionFactory(connectionFactory);
//        return factory;
//    }
//}
